<script>
	import { mapMutations } from 'vuex';
	export default {
		onLaunch: function() {
			let _this = this;
			uni.getStorage({
				key: 'userInfo',
				success: function (res) {
					_this.isLogin(true)
					_this.isUserInfo(JSON.parse(res.data))
					uni.getStorage({
						key: 'wxuserInfo',
						success: function (res) {
							_this.setrefresh(JSON.parse(res.data))
						}
					});
					if(res.data){
						uni.reLaunch({
							url:'/pages/index/index'
						})
					}
				},
				fail(){
					uni.clearStorage();
					uni.reLaunch({
						url:"/pages/login/login"
					})
				}
			});
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods:{
			...mapMutations(['isLogin','isUserInfo','setrefresh'])
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import './common/common.css';
	@import './common/zcm-main.css';
</style>
